package com.x.microshpere.order.core.controller;

import com.x.microshpere.order.core.service.OrderService;
import com.x.microsphere.order.client.apis.OrderApi;
import com.x.microsphere.stock.client.interfaces.StockService;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 订单控制器
 *
 * @author fanzhaofei
 * @since 2022/12/3 19:04
 */
@RestController
public class OrderController implements OrderApi {
    @Resource
    private OrderService orderService;
    @Resource
    private StockService stockService;

    @Override
    public Boolean saveOrder() {
        return orderService.saveOrder() && stockService.deduct();
    }
}
